import echarts from "echarts"

const install = function (Vue) {
    Object.defineProperties(Vue.prototype, {
        $charts: {
            get() {
                return {
                    LineMap: function (id,data) {
                        var chartDom = document.getElementById(id);
                        var myChart = echarts.init(chartDom);
                        var option = {
                            title: {
                              text: 'Stacked Line'
                            },
                            tooltip: {
                              trigger: 'axis'
                            },
                            legend: {
                              data: ['Video Ads',]
                            },
                            grid: {
                              left: '3%',
                              right: '4%',
                              bottom: '3%',
                              containLabel: true
                            },
                            toolbox: {
                              feature: {
                                saveAsImage: {}
                              }
                            },
                            xAxis: {
                              type: 'category',
                              boundaryGap: false,
                              data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
                            },
                            yAxis: {
                              type: 'value'
                            },
                            series: [
                            
                              {
                                name: 'Video Ads',
                                type: 'line',
                                stack: 'Total',
                                data: [150, 232, 201, 154, 190, 330, 410]
                              }
                            ]
                          };
                        myChart.setOption(option);
                    },
                    BingMap: function (id,data) {
                      var chartDom = document.getElementById(id);
                      var myChart = echarts.init(chartDom);
                      var option = {
                        legend: {
                          top: 'bottom'
                        },
                        series: [
                          {
                            name: 'Nightingale Chart',
                            type: 'pie',
                            radius: [20, 80],
                            center: ['50%', '50%'],
                            roseType: 'area',
                            itemStyle: {
                              borderRadius: 8
                            },
                            data: [
                              { value: 40, name: 'Ⅲ级围岩' },
                              { value: 38, name: 'Ⅳ级围岩' },
                              { value: 32, name: 'Ⅴ级围岩' }
                            ]
                          }
                        ]
                      };
                      myChart.setOption(option);
                  },
                  BingMap: function (id,data) {
                    var chartDom = document.getElementById(id);
                    var myChart = echarts.init(chartDom);
                    var option = {
                      legend: {
                        bottom: '20'
                      },
                      series: [
                        {
                          name: 'Nightingale Chart',
                          type: 'pie',
                          radius: ['20%', '50%'],
                          center: ['50%', '25%'],
                          roseType: 'area',
                          itemStyle: {
                            borderRadius: 8
                          },
                          labelLine:{
                            length:5
                          },
                          data: [
                            { value: 40, name: 'Ⅲ级围岩' },
                            { value: 38, name: 'Ⅳ级围岩' },
                            { value: 32, name: 'Ⅴ级围岩' }
                          ]
                        }
                      ]
                    };
                    myChart.setOption(option);
                }
                }
                
            }
        }
    })
}

export default install